var uniqueInOrder = function (iterable) {
    let result = [];
    for (let i = 0; i < iterable.length; i++) {
        result.push(iterable[i]);
        if (iterable[i] === iterable[i + 1]) {
            result.pop();
        }
    }
    return result;
};

function uniqueInOrder2(it) {
    var result = [];
    var last;
    for (var i = 0; i < it.length; i++) {
        if (it[i] !== last) {
            result.push((last = it[i]));
        }
    }
    return result;
}

function uniqueInOrder3(iterable){
    return [...iterable].filter((a, i) => a !== iterable[i-1])
}

console.log(uniqueInOrder([1, 2, 2, 3, 3, 3, 4, 3]));
console.log(uniqueInOrder2('ABBCcAD'));
console.log(uniqueInOrder3('AAAABBBCCDAABBB'));
console.log(uniqueInOrder3([1, 2, 2, 3, 3, 3, 4, 3]));